<!DOCTYPE html>
<html>

<head>
    <script src="https://d3js.org/d3.v4.min.js">
    </script>
</head>

<body>
    <h1 style="text-align:center; 
             color:green;">
        GeeksforGeeks
    </h1>

    <center>
        <svg id="gfg" width="200" height="200">
        </svg>
    </center>

    <script>
        var data = [
            { x: 0, y: 10 },
            { x: 10, y: 30 },
            { x: 20, y: 150 },
            { x: 50, y: 10 },
            { x: 60, y: 150 },
            { x: 70, y: 50 },
            { x: 80, y: 190 }];

        data.sort((a, b) => a.y - b.y);

        var xScale = d3.scaleLinear()
            .domain([0, 8])
            .range([25, 200]);
        var yScale = d3.scaleLinear()
            .domain([0, 20])
            .range([200, 25]);

        // Using area() function to 
        // generate area 
        var Gen = d3.area()
            .x0((p) => p.x)
            .x((p) => 0)
            .y1((p) => p.y);

        d3.select("#gfg")
            .append("path")
            .attr("d", Gen(data))
            .attr("fill", "green")
            .attr("stroke", "black"); 
    </script>
</body>

</html>